<template>
  <Edit
    ref="edit"
    :titles="titles"
    :services="services"
    :rules="rules"
    v-bind="$attrs"
    v-on="$listeners"
  >
    <template v-slot="{ formData }">
      <el-form-item :label="$t('field.rejectReason')" prop="reason">
        <el-select v-model="formData.reason" :placeholder="$tSelect()">
          <el-option
            v-for="item in dictData['student_reject_reason']"
            :key="item.id"
            :label="item.name"
            :value="item.id"
          />
        </el-select>
      </el-form-item>
    </template>
  </Edit>
</template>

<script>
import { dictMixin } from 'mixins'
import { Edit } from 'components'
import { approvalStudent } from 'services/school/student'
export default {
  name: 'ApprovalReason',
  mixins: [dictMixin],
  components: { Edit },
  dicts: ['student_reject_reason'],
  data() {
    return {
      services: {
        update: approvalStudent
      },
      dictData: {}
    }
  },
  computed: {
    titles() {
      return {
        update: '驳回认证'
      }
    },
    rules() {
      return {
        code: this.$rule('field.rejectReason', {
          required: true
        })
      }
    }
  },
  methods: {
    show(data) {
      this.$refs.edit.show(data)
    }
  }
}
</script>
